package cn.lg.soar.system.feign;

import cn.lg.soar.common.util.token.LoginInfo;
import cn.lg.soar.core.annotations.ApiClient;
import cn.lg.soar.system.api.constant.ModuleConst;
import cn.lg.soar.system.api.model.TokenInfoDTO;
import cn.lg.soar.system.api.service.ILoginApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author luguoxiang
 * @date 2022/1/2
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@ConditionalOnMissingClass("cn.lg.soar.system.biz.modules.auth.client.LoginApiClient")
@ApiClient
@FeignClient(
        name= ModuleConst.MODULE_NAME,
        path= ModuleConst.CLIENT_PATH + "/login",
        contextId="LoginApiFeign"
)
public interface LoginApiFeign extends ILoginApi {

    @PostMapping("login1")
    @Override
    TokenInfoDTO login(@RequestBody LoginInfo loginInfo, @RequestParam("refreshExpires") long refreshExpires);

    @PostMapping("login2")
    @Override
    TokenInfoDTO login(@RequestBody LoginInfo loginInfo, @RequestParam("rememberMe") boolean rememberMe);

    @GetMapping("logoutByTokenId")
    @Override
    void logoutByTokenId(@RequestParam("tokenId") Long tokenId);

    @GetMapping("logout1")
    @Override
    void logout(@RequestParam("userId") Long userId);

    @GetMapping("logout2")
    @Override
    void logout(@RequestParam("userId") Long userId, @RequestParam("clientType") Integer clientType);

}
